<?php
require_once("includes/application_top.php");
	
if($_POST['action']=='add_email_newsletter')
{
	$email = tep_db_prepare_input($_POST['email_address']);
	//check email is not exits
	$email_query = "select * from newsletters_email where email_address= '" . $email . "'";
	$check_email = tep_db_query($email_query);
	if(tep_db_num_rows($check_email) >0)
	{
		echo "This email is exit";
	}
	else
	{
		$insert_query = "insert into newsletters_email(email_address) values('" . $email . "');";
		tep_db_query($insert_query);
		echo "Register newsletter success!";
	}
}
?>